POV-Ray : Newsgroups : povray.newusers : How to compose an arbitrary solid object : Re: How to compose an arbitrary solid object Server Time
5 Sep 2024 22:21:22 EDT (-0400)
  Re: How to compose an arbitrary solid object  
From: Ron Parker
Date: 30 Jul 1999 13:38:24
Message: <37a1e310@news.povray.org>
On Fri, 30 Jul 1999 09:59:43 -0700, Ken wrote:
>  Problem you have here is that you have pretty much defined the problem and
>there is no real solution other that using solid construction methods. Finite
>patch primitives are useful little buggers but the one or two restrictions
>they have can be a bother. You can't even use them in CSG operations to
>carve out shapes from the solid primitives with and their thickness is so
>thin they make poor refractive objects (boo oho).

Not so.  Render the scene below and you'll see what I mean.  

The first cube (from the left) is made of six bicubic patches with no
interior, for reference.  The next cube is made of six "unrelated"
bicubic patches, each with its own interior.  The third cube is a 
union of bicubic patches, with one interior for the whole union.
The last cube is a box, again for reference.

Notice that the third and fourth cubes have the same basic refractive
characteristics.  The second cube is broken because POV can't make the
correlation between the distinct patches and their interiors, so it
bends the ray upon entry to the first patch but hitting subsequent
patches has no effect because they have the same ior as the material
that the ray is already traveling through.  POV interprets this as 
"entering a new object" instead of "leaving the object we were in"
because it uses the interiors to distinguish one object from another.
Since the patches have different interiors, they are different 
objects.

So, you can use patch objects to do refraction.  You just have to 
be careful.

----------------- cut here ------->8===========

camera {location <-1,5,-5> look_at -x}
light_source {<-20,20,-20> rgb 1 shadowless}
light_source {<20,20,-20> rgb 1 shadowless}

plane {y,0 texture {pigment {checker rgb .5,rgb 1}} rotate 30*y}

#declare patch=bicubic_patch { type 1 flatness .1 u_steps 3 v_steps 3 
                <-.5,-.5,-.5> <-.4,-.5,-.5> <.4,-.5,-.5> <.5,-.5,-.5>
                <-.5,-.4,-.5> <-.4,-.4,-.5> <.4,-.4,-.5> <.5,-.4,-.5>
                <-.5,.4,-.5> <-.4,.4,-.5> <.4,.4,-.5> <.5,.4,-.5>
                <-.5,.5,-.5> <-.4,.5,-.5> <.4,.5,-.5> <.5,.5,-.5>
              }

#declare pig=pigment {color rgbt .7}

//cube 1
object {patch rotate 000*x translate y-4*x texture {pig}}
object {patch rotate 090*x translate y-4*x texture {pig}}
object {patch rotate 180*x translate y-4*x texture {pig}}
object {patch rotate 270*x translate y-4*x texture {pig}}
object {patch rotate 090*y translate y-4*x texture {pig}}
object {patch rotate 270*y translate y-4*x texture {pig}}

//cube 2
object {patch rotate 000*x translate y-2*x texture {pig} interior {ior 1.3}}
object {patch rotate 090*x translate y-2*x texture {pig} interior {ior 1.3}}
object {patch rotate 180*x translate y-2*x texture {pig} interior {ior 1.3}}
object {patch rotate 270*x translate y-2*x texture {pig} interior {ior 1.3}}
object {patch rotate 090*y translate y-2*x texture {pig} interior {ior 1.3}}
object {patch rotate 270*y translate y-2*x texture {pig} interior {ior 1.3}}

// cube 3
union {
object {patch rotate 000*x translate y texture {pig}}
object {patch rotate 090*x translate y texture {pig}}
object {patch rotate 180*x translate y texture {pig}}
object {patch rotate 270*x translate y texture {pig}}
object {patch rotate 090*y translate y texture {pig}}
object {patch rotate 270*y translate y texture {pig}}
interior {ior 1.3} 
}
             
// cube 4 
box { -.5 .5 translate y+2*x texture {pig} interior {ior 1.3}}
----------------- cut here ------->8===========


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.